﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace WoSoft.PACS.Utility
{
    /// <summary>
    /// 通用日志处理帮助类
    /// </summary>
    public class GenericLoger
    {
        public static void Logger(string moduleName ,string function, Action tryHandle, Action<Exception> catchHandle = null, Action finallyHandle = null)
        {
            try
            {
                LogHelper.Debug(moduleName + "." + function);
                tryHandle();
            }
            catch (Exception ex)
            {
                LogHelper.Error(function + "失败", ex);

                //执行异常处理
                if (catchHandle != null)
                    catchHandle(ex);
            }
            finally
            {
                if (finallyHandle != null)
                    finallyHandle();
            }
        }

    }
}
